package service

import (
	"github.com/casbin/casbin/v2"
	gormadapter "github.com/casbin/gorm-adapter/v3"
	"gorm.io/gorm"
)

func initRBAC(orm *gorm.DB) *casbin.Enforcer {
	adapter, _ := gormadapter.NewAdapterByDB(orm)
	e, _ := casbin.NewEnforcer("conf/model.conf", adapter)
	err := e.LoadPolicy()
	if err != nil {
		panic("RBAC Init error")
	}

	return e

}
